package com.neusoft.demo.mapper;


import com.neusoft.demo.pojo.Yuangong;
import org.apache.ibatis.annotations.*;

@Mapper
@CacheNamespace
public interface YuangongMapper {
    @Insert("insert into yuangong(yname,word,sal,id) values(#{yname},#{word},#{sal},#{id})")
    public  int addYuangong(Yuangong yuangong);
    @Update("update yuangong set yname=#{yname},word=#{word},sal=#{sal} where yid=#{yid} ")
    public  int updateYuangong(Yuangong yuangong);
    @Delete("delete from yuangong where yid=#{yid}")
    public  int delYuangong(int yid);
    @Select("select * from yuangong order by yid desc")
    public  java.util.List<Yuangong> findYuangong();
    @Select("select * from yuangong where id=#{id}")
    public  java.util.List<Yuangong> findYuangongById(Integer id);
    //@Select("select * from yuangong where yname like concat('%',#{yname},'%' ) and (sal>=#{beginSal} and sal<=#{endSal})")
//
    @Select("<script> select * from yuangong <where>" +
            "<if test=\"yname!=null and yname!=''\"> yname like concat('%',#{yname},'%')</if>" +
            "<if test=\"beginSal!=null and beginSal!=0 \"> and  sal>=#{beginSal} </if>" +
            "<if test=\"endSal!=null and endSal!=0 \"> and  sal&lt;=#{endSal} </if> " +
            "</where> </script>")

    public java.util.List<Yuangong> yuangongSearch(String yname,int beginSal,int endSal);


}
